﻿<UserControl x:Class="Indigo.Quibbler.Controls.SpiderControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:controls="clr-namespace:Indigo.Quibbler.Controls"
    Height="Auto" Width="Auto">
    <UserControl.Resources>
        <DataTemplate DataType="{x:Type controls:SpiderControlBaseNode}">
            <controls:SpiderNode x:Name="articleBaseControl" ImageUrl="{Binding ImageUrl}" Headline="{Binding Headline}" SubHeadline="{Binding SubHeadline}" PubDate="{Binding PubDate}" Article="{Binding Article}" Width="200" Height="150" Click="_articleSpider_Click" MouseDoubleClick="_spiderDoubleClicked"/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type controls:SpiderPhotoNode}">
            <controls:SpiderImageControl x:Name="imageBaseControl" ImageUrl="{Binding ImageUrl}" Headline="{Binding Headline}" SubHeadline="{Binding SubHeadline}" PubDate="{Binding PubDate}" Article="{Binding Article}" Width="200" Height="150" Click="_articleSpider_Click" MouseDoubleClick="_spiderDoubleClicked"/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type controls:SpiderControlSearchCenterNode}">
            <Border Background="#333333" CornerRadius="5" Padding="5" BorderBrush="#666666" BorderThickness="2" MinWidth="50">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Text="{Binding Path=SearchTerm}" Foreground="#DDDDDD" FontSize="18" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock HorizontalAlignment="Center" Grid.Row="1">
                  <Hyperlink FontSize="16" Foreground="#DDDDDD" NavigateUri="{Binding Path=SearchUrl}" Hyperlink.RequestNavigate="hyperlink_RequestNavigate">Click here to search online</Hyperlink></TextBlock>
                </Grid>
            </Border>
        </DataTemplate>
        <DataTemplate DataType="{x:Type controls:SpiderControlCenterNode}">
            <Border BorderBrush="Silver" BorderThickness="0">
                <controls:SpiderNode x:Name="articleCenterControl" ImageUrl="{Binding ImageUrl}" Headline="{Binding Headline}" SubHeadline="{Binding SubHeadline}" PubDate="{Binding PubDate}" Article="{Binding Article}" Width="200" Height="150" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="_articleSpider_Click"/>
            </Border>
        </DataTemplate>
		
       <ControlTemplate x:Key="CloseButtonTemplate" TargetType="{x:Type Button}">
       <Grid x:Name="grid">
           <Image x:Name="Image" Source="pack://application:,,/Quibbler - Universal News Reader;component/Images/btn-close.png" Stretch="Fill"/>
       </Grid>
       <ControlTemplate.Triggers>
           <Trigger Property="IsMouseOver" Value="True">
               <Setter TargetName="grid" Property="RenderTransform" >
                   <Setter.Value>
                       <TranslateTransform Y="1.0" X="1.0"/>
                   </Setter.Value>
               </Setter>
           </Trigger>
           <Trigger Property="IsPressed" Value="True">
               <Setter TargetName="grid" Property="Effect" >
                   <Setter.Value>
                       <DropShadowEffect ShadowDepth="5"/>
                   </Setter.Value>
               </Setter>
               <Setter TargetName="grid" Property="RenderTransform" >
                   <Setter.Value>
                       <TranslateTransform Y="1.0" X="1.0"/>
                   </Setter.Value>
               </Setter>
           </Trigger>
           <Trigger Property="IsEnabled" Value="false">
               <Setter TargetName="grid" Property="Opacity" Value="0.5"/>
           </Trigger>
       </ControlTemplate.Triggers>
   </ControlTemplate>
    </UserControl.Resources>
    <Grid>
        <controls:SpiderViewerControl x:Name="photoExplorer"/>
		<Button x:Name="btnClose" ToolTip="Close"
		 	Background="{x:Null}" BorderBrush="{x:Null}" Template="{StaticResource CloseButtonTemplate}"
			HorizontalAlignment="Right" VerticalAlignment="Top" Height="30" Width="30" Margin="5" />
    </Grid>
</UserControl>
